<template>
	<view class="competitive-summary" @click="navTo" :style="istyle">
		<view class="subject">{{ item.subject_name}}</view>
		<view class="summary-wrap">
			<view class="summary">
				<text class="title">{{ item.course_title }}</text>
				<text class="date">{{item.start_month}} - {{item.end_month}}</text>
			</view>
			<view class="discount">
				<text class="now">{{ item.course_real_price ? '¥'+item.course_real_price/100 : '免费'}}</text>
				<text class="before" v-if="item.course_price">{{ '¥' + item.course_price/100 }}</text>
			</view>
		</view>
		<view class="teacher-wrap">
			<view class="teacher" v-for="(src, index2) in item.figureimgsList" :key="index2">
				<view class="avatar">
					<image class="pic" :src="src"></image>
				</view>
				<!-- <text class="name" v-if="card.lesson_teachers.length<3">{{ teacher.t_name }}</text> -->
			</view>
			<!-- 这里要知道是要显示哪个， 有已报名，剩余名额，以及 距离结束-->
			<view class="statistic">
				<view>剩余名额{{ item.course_store }}</view>
				<view v-if="item.enrol_end_time > 0">距离结束{{ item.enrol_end_time }}天</view>
				<view v-else>已结束</view>
			</view>
			<!-- <view>
				<text>距离结束{{item.course_store}}天</text>
			</view> -->
		</view>
	</view>
</template>

<script>
	export default {
		data () {
			return {
				
			}
		},
		props: {
			item: Object,
			istyle: String,
			disableNav:	Boolean		//禁止nav跳转
		},
		methods:{
			navTo(){
				if(this.item.enrol_end_time > 0) {
					uni.navigateTo({
						url: '/pages/free-lesson/lesson-detail?course_id='+this.item.course_id
					})
				} else {
					uni.showToast({
						title: '报名时间已结束',
						icon: 'none'
					})
				}
			}
		},
	}
</script>

<style scoped>
	.competitive-summary{position:relative; display:flex; flex-direction: column; width:100%; padding:40upx 30upx 30upx; background:#FFF; box-sizing: border-box; border-radius: 20upx;margin-bottom: 20upx;}
	
	.subject{position: absolute; z-index:99; left:30upx; top:0;  width:58upx; height:32upx; background:#fe9900; border-radius: 0 0 10upx 10upx; font-size:24upx; text-align: center; line-height:32upx; color:#fff;}

	.summary-wrap{display:flex; margin-top: -12upx; margin-bottom: 22upx;}
	.summary{display:flex; flex-direction: column;max-width: 75%;}
	.summary .title{font-size:34upx; font-weight:bold; color:#333;}
	.summary .date{font-size:24upx; color:#999;}
	
	.discount{display:flex; flex-direction: column;}
	.discount .now{height:56upx; font-size:36upx; color:#FF9900;}
	.discount .before{font-size:26upx; color:#CCC; text-decoration: line-through;}
	
	.summary-wrap .discount{flex:1; text-align: right;min-width: 100upx;}
	
	.teacher-wrap{display:flex; margin-top:10upx;}
	.teacher{display:flex; margin-right:40upx;}
	.teacher .avatar{border-radius: 50%; width:60upx; height:60upx; overflow: hidden;}
	.teacher .avatar .pic{width:100%; height:100%; background:rgba(130,255,221,0.7);}
	.teacher .name{margin-left:20upx; margin-top:6upx; color:#666;}
	
	.teacher-wrap .statistic{flex:1; text-align: right; color:#666;}
	.teacher-wrap .statistic view{ font-size: 20upx; font-family:Source Han Sans CN; font-weight:400; line-height:34upx; color:#666;}
	
</style>
